<template>
  <div>
    <button @click="getbbq">获取MyHeader组件上的ref</button>
    <MyHeader ref="yasuo"/>
    <hr>
    <Count/>
  </div>
</template>

<script>
import MyHeader from './components/MyHeader';
import Count from './components/Count';
export default {
name:'App',
components:{
  MyHeader,
  Count,
},
methods:{
  getbbq(){
    /* 
        如果把ref属性写在一个组件上,那么$refs对象上保存的是组件实例
      */
     console.log(this.$refs);
     console.log(this.$refs.yasuo);
  }
}
}
</script>

<style scoped>

</style>